jQuery.fn.extend({
	iSlider: function(d) {
		var e = {
			speed: 1960,
			delay: 2000,
			transition: "random",
			caption: true,
			control: true
		};
		var f = $.extend(e, d);
		var g = this,
			_slider, _w, _h, _t, total, items = 18,
			type = f.transition,
			_b;
		total = $("li", g).length;
		$(g).addClass("ibanner");
		$("ul", g).wrap("<div class=\"origin\" />");
		loadImage($("li:first img", g).attr("src"), function() {
			h = $("li:first img", g).height();
			_init(h)
		});

		function doslider(a, b) {
			if (a == undefined) a = 0;
			if (a >= total) a = 0;
			w = $("li:eq(" + a + ") img", g).width();
			h = $("li:eq(" + a + ") img", g).height();
			$(".slider-box", g).css({
				"margin-left": Math.floor(($(g).width() - w) / 2) + "px",
				"width": w + "px"
			}).find("a:first").attr("href", $("li:eq(" + a + ") a", g).attr("href"));
			$(".slider-buttons a:eq(" + a + ")", g).addClass("active").siblings(".active").removeClass("active");
			if (f.caption) {
				$(".slider-caption", g).css("margin-left", 0).html($("li:eq(" + a + ") img", g).attr("alt")).animate({
					"margin-left": ($("li:eq(" + a + ") img", g).attr("alt") == "" ? 0 : -$(".slider-caption", g).outerWidth(true)) + "px"
				}, f.speed, "easeInOutExpo")
			}
			if (type == "random") {
				types = ["fade", "up", "left", "down", "blinds", "blindsup", "blindsdown", "blindsuprandom", "blindsdownrandom", "blindsrandom", "blindsxrandom", "puzzle", "swape"];
				type = types[Math.round((types.length * Math.random()))]
			}
			if (b == undefined) {
				$(".slider-item", g).each(function(i) {
					$(this).css({
						"left": Math.ceil(w / items) * i + "px",
						"width": Math.ceil(w / items) + "px",
						"background": "url(" + $("li:eq(" + a + ") img", g).attr("src") + ") no-repeat " + (-Math.ceil(w / items) * i) + "px" + " 0"
					})
				});
				b = true
			} else {
				switch (type) {
				case "fade":
					$(".slider-item", g).each(function(i) {
						$(this).css({
							"opacity": 0,
							"left": Math.ceil(w / items) * i + "px",
							"width": Math.ceil(w / items) + "px",
							"background": "url(" + $("li:eq(" + a + ") img", g).attr("src") + ") no-repeat " + (-Math.ceil(w / items) * i) + "px" + " 0"
						}).stop().animate({
							opacity: 1
						}, f.speed)
					});
					break;
				case "up":
					$(".slider-item", g).each(function(i) {
						$(this).css({
							"opacity": 0,
							"left": Math.ceil(w / items) * i + "px",
							"margin-top": h + "px",
							"width": Math.ceil(w / items) + "px",
							"background": "url(" + $("li:eq(" + a + ") img", g).attr("src") + ") no-repeat " + (-Math.ceil(w / items) * i) + "px" + " 0"
						}).stop().animate({
							marginTop: 0,
							opacity: 1
						}, f.speed, "easeInOutExpo")
					});
					break;
				case "left":
					$(".slider-item", g).each(function(i) {
						$(this).css({
							"opacity": 0,
							"left": Math.ceil(w / items) * i + "px",
							"margin-left": w + "px",
							"width": Math.ceil(w / items) + "px",
							"background": "url(" + $("li:eq(" + a + ") img", g).attr("src") + ") no-repeat " + (-Math.ceil(w / items) * i) + "px" + " 0"
						}).stop().animate({
							marginLeft: 0,
							opacity: 1
						}, f.speed, "easeInOutExpo")
					});
					break;
				case "down":
					$(".slider-item", g).each(function(i) {
						$(this).css({
							"opacity": 0,
							"left": Math.ceil(w / items) * i + "px",
							"margin-top": -h + "px",
							"background": "url(" + $("li:eq(" + a + ") img", g).attr("src") + ") no-repeat " + (-Math.ceil(w / items) * i) + "px" + " 0"
						}).stop().animate({
							marginTop: 0,
							opacity: 1
						}, f.speed, "easeInOutExpo")
					});
					break;
				case "blinds":
					$(".slider-item", g).each(function(i) {
						$(this).css({
							"opacity": 0,
							"left": Math.ceil(w / items) * i + "px",
							"width": Math.ceil(w / items) + "px",
							"background": "url(" + $("li:eq(" + a + ") img", g).attr("src") + ") no-repeat " + (-Math.ceil(w / items) * i) + "px" + " 0"
						}).stop().delay(60 * i).animate({
							opacity: 1
						}, f.speed - 60 * items, "easeInOutExpo")
					});
					break;
				case "blindsup":
					$(".slider-item", g).each(function(i) {
						$(this).css({
							"opacity": 0,
							"left": Math.ceil(w / items) * i + "px",
							"margin-top": h + "px",
							"width": Math.ceil(w / items) + "px",
							"background": "url(" + $("li:eq(" + a + ") img", g).attr("src") + ") no-repeat " + (-Math.ceil(w / items) * i) + "px" + " 0"
						}).stop().delay(60 * i).animate({
							opacity: 1,
							marginTop: 0
						}, f.speed - 60 * items, "easeInOutExpo")
					});
					break;
				case "blindsdown":
					$(".slider-item", g).each(function(i) {
						$(this).css({
							"opacity": 0,
							"left": Math.ceil(w / items) * i + "px",
							"margin-top": -h + "px",
							"width": Math.ceil(w / items) + "px",
							"background": "url(" + $("li:eq(" + a + ") img", g).attr("src") + ") no-repeat " + (-Math.ceil(w / items) * i) + "px" + " 0"
						}).stop().delay(60 * i).animate({
							opacity: 1,
							marginTop: 0
						}, f.speed - 60 * items, "easeInOutExpo")
					});
					break;
				case "blindsuprandom":
					$(".slider-item", g).each(function(i) {
						$(this).css({
							"opacity": 0,
							"left": Math.ceil(w / items) * i + "px",
							"margin-top": h * Math.random() + "px",
							"width": Math.ceil(w / items) + "px",
							"background": "url(" + $("li:eq(" + a + ") img", g).attr("src") + ") no-repeat " + (-Math.ceil(w / items) * i) + "px" + " 0"
						}).stop().animate({
							opacity: 1,
							marginTop: 0
						}, f.speed, "easeInOutExpo")
					});
					break;
				case "blindsdownrandom":
					$(".slider-item", g).each(function(i) {
						$(this).css({
							"opacity": 0,
							"left": Math.ceil(w / items) * i + "px",
							"margin-top": -(h * Math.random()) + "px",
							"width": Math.ceil(w / items) + "px",
							"background": "url(" + $("li:eq(" + a + ") img", g).attr("src") + ") no-repeat " + (-Math.ceil(w / items) * i) + "px" + " 0"
						}).stop().animate({
							opacity: 1,
							marginTop: 0
						}, f.speed, "easeInOutExpo")
					});
					break;
				case "blindsrandom":
					$(".slider-item", g).each(function(i) {
						$(this).css({
							"opacity": 0,
							"left": Math.ceil(w / items) * i + "px",
							"margin-top": h * Math.random() * (Math.random() > .5 ? 1 : -1) + "px",
							"width": Math.ceil(w / items) + "px",
							"background": "url(" + $("li:eq(" + a + ") img", g).attr("src") + ") no-repeat " + (-Math.ceil(w / items) * i) + "px" + " 0"
						}).stop().animate({
							opacity: 1,
							marginTop: 0
						}, f.speed, "easeInOutExpo")
					});
					break;
				case "blindsxrandom":
					$(".slider-item", g).each(function(i) {
						$(this).css({
							"opacity": 0,
							"left": Math.ceil(w / items) * i + "px",
							"margin-left": w * Math.random() * (Math.random() > .5 ? 1 : -1) + "px",
							"width": Math.ceil(w / items) + "px",
							"background": "url(" + $("li:eq(" + a + ") img", g).attr("src") + ") no-repeat " + (-Math.ceil(w / items) * i) + "px" + " 0"
						}).stop().animate({
							opacity: 1,
							marginLeft: 0
						}, f.speed, "easeInOutExpo")
					});
					break;
				case "puzzle":
					$(".slider-item", g).each(function(i) {
						$(this).css({
							"opacity": 0,
							"left": Math.ceil(w / items) * i + "px",
							"margin-top": h * Math.random() * (Math.random() > .5 ? 1 : -1) * 2 + "px",
							"margin-left": w * Math.random() * (Math.random() > .5 ? 1 : -1) + "px",
							"width": Math.ceil(w / items) + "px",
							"background": "url(" + $("li:eq(" + a + ") img", g).attr("src") + ") no-repeat " + (-Math.ceil(w / items) * i) + "px" + " 0"
						}).stop().animate({
							opacity: 1,
							marginTop: 0,
							marginLeft: 0
						}, f.speed, "easeInOutExpo")
					});
					break;
				case "swape":
					$(".slider-item", g).each(function(i) {
						$(this).css({
							"opacity": 0,
							"left": Math.ceil(w / items) * i + "px",
							"width": 0,
							"background": "url(" + $("li:eq(" + a + ") img", g).attr("src") + ") no-repeat " + (-Math.ceil(w / items) * i) + "px" + " 0"
						}).stop().delay(60 * i).animate({
							opacity: 1,
							"width": Math.ceil(w / items) + "px"
						}, f.speed - 60 * items, "easeInOutExpo")
					});
					break
				}
			}
			$(".slider-process", g).stop().css("width", 0).animate({
				"width": "100%"
			}, f.speed + f.delay, "linear");
			if (_b) clearTimeout(_b);
			_b = setTimeout(function() {
				$(g).css("background-image", "url(" + $("li:eq(" + a + ") img", g).attr("src") + ")")
			}, f.speed);
			type = f.transition;
			_t = setTimeout(function() {
				a++;
				doslider(a, b)
			}, f.speed + f.delay)
		}
		function _init(a) {
			$(g).append("<div class=\"slider-box cf\"><a /><div class=\"slider-buttons\"></div></div><div class=\"slider-process\"></div><div class=\"slider-caption\"></div>");
			for (var i = 0; i < items; i++) {
				$(".slider-box a", g).append("<div class=\"slider-item\">")
			}
			for (var i = 0; i < total; i++) {
				$(".slider-buttons", g).append("<a />")
			}
			$(".slider-buttons a").each(function(i) {
				$(this).on("click", function() {
					clearTimeout(_t);
					doslider(i, true)
				})
			});
			if (!f.control) $(".slider-buttons", g).remove();
			_slider = $(".slider-box", g);
			$(g).css("height", a + "px");
			$(".slider-box", g).css("height", a + "px");
			_w = $(g).width();
			$(".slider-item", g).css("height", a + "px");
			$(window).bind("resize", function() {
				$(".slider-box", g).css("margin-left", Math.floor(($(g).width() - $(".slider-box", g).width()) / 2) + "px")
			});
			doslider()
		}
		function loadImage(a, b) {
			var c = new Image();
			c.src = a;
			if (c.complete) {
				b.call();
				return
			}
			c.onload = function() {
				b()
			}
		}
	}
});
/*
 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
 *
 * Uses the built in easing capabilities added In jQuery 1.1
 * to offer multiple easing options
 *
 * TERMS OF USE - jQuery Easing
 * 
 * Open source under the BSD License. 
 * 
 * Copyright © 2008 George McGinley Smith
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without modification, 
 * are permitted provided that the following conditions are met:
 * 
 * Redistributions of source code must retain the above copyright notice, this list of 
 * conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice, this list 
 * of conditions and the following disclaimer in the documentation and/or other materials 
 * provided with the distribution.
 * 
 * Neither the name of the author nor the names of contributors may be used to endorse 
 * or promote products derived from this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
 * OF THE POSSIBILITY OF SUCH DAMAGE. 
 *
*/

// t: current time, b: begInnIng value, c: change In value, d: duration
jQuery.easing['jswing'] = jQuery.easing['swing'];

jQuery.extend( jQuery.easing,
{
	def: 'easeOutQuad',
	swing: function (x, t, b, c, d) {
		//alert(jQuery.easing.default);
		return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
	},
	easeInQuad: function (x, t, b, c, d) {
		return c*(t/=d)*t + b;
	},
	easeOutQuad: function (x, t, b, c, d) {
		return -c *(t/=d)*(t-2) + b;
	},
	easeInOutQuad: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t + b;
		return -c/2 * ((--t)*(t-2) - 1) + b;
	},
	easeInCubic: function (x, t, b, c, d) {
		return c*(t/=d)*t*t + b;
	},
	easeOutCubic: function (x, t, b, c, d) {
		return c*((t=t/d-1)*t*t + 1) + b;
	},
	easeInOutCubic: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t + b;
		return c/2*((t-=2)*t*t + 2) + b;
	},
	easeInQuart: function (x, t, b, c, d) {
		return c*(t/=d)*t*t*t + b;
	},
	easeOutQuart: function (x, t, b, c, d) {
		return -c * ((t=t/d-1)*t*t*t - 1) + b;
	},
	easeInOutQuart: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
		return -c/2 * ((t-=2)*t*t*t - 2) + b;
	},
	easeInQuint: function (x, t, b, c, d) {
		return c*(t/=d)*t*t*t*t + b;
	},
	easeOutQuint: function (x, t, b, c, d) {
		return c*((t=t/d-1)*t*t*t*t + 1) + b;
	},
	easeInOutQuint: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
		return c/2*((t-=2)*t*t*t*t + 2) + b;
	},
	easeInSine: function (x, t, b, c, d) {
		return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
	},
	easeOutSine: function (x, t, b, c, d) {
		return c * Math.sin(t/d * (Math.PI/2)) + b;
	},
	easeInOutSine: function (x, t, b, c, d) {
		return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
	},
	easeInExpo: function (x, t, b, c, d) {
		return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
	},
	easeOutExpo: function (x, t, b, c, d) {
		return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
	},
	easeInOutExpo: function (x, t, b, c, d) {
		if (t==0) return b;
		if (t==d) return b+c;
		if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
		return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
	},
	easeInCirc: function (x, t, b, c, d) {
		return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
	},
	easeOutCirc: function (x, t, b, c, d) {
		return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
	},
	easeInOutCirc: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
		return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
	},
	easeInElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
	},
	easeOutElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
	},
	easeInOutElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
		return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
	},
	easeInBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		return c*(t/=d)*t*((s+1)*t - s) + b;
	},
	easeOutBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
	},
	easeInOutBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158; 
		if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
		return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
	},
	easeInBounce: function (x, t, b, c, d) {
		return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
	},
	easeOutBounce: function (x, t, b, c, d) {
		if ((t/=d) < (1/2.75)) {
			return c*(7.5625*t*t) + b;
		} else if (t < (2/2.75)) {
			return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
		} else if (t < (2.5/2.75)) {
			return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
		} else {
			return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
		}
	},
	easeInOutBounce: function (x, t, b, c, d) {
		if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
		return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
	}
});

/*
 *
 * TERMS OF USE - EASING EQUATIONS
 * 
 * Open source under the BSD License. 
 * 
 * Copyright © 2001 Robert Penner
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without modification, 
 * are permitted provided that the following conditions are met:
 * 
 * Redistributions of source code must retain the above copyright notice, this list of 
 * conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice, this list 
 * of conditions and the following disclaimer in the documentation and/or other materials 
 * provided with the distribution.
 * 
 * Neither the name of the author nor the names of contributors may be used to endorse 
 * or promote products derived from this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
 * OF THE POSSIBILITY OF SUCH DAMAGE. 
 *
 */